import {getUrl,postUrl} from '@/utils/http/htpp'   //引入请求方式
import app from '../utils/request/http'

//pc登录
export const LoginPc=(data)=>{
    const {username,password}=data
    //btoa  64位加密一波
    //atob  64位解密一波
    console.log(username,password)
    const encode = btoa(encodeURI(username+':'+password))
    console.log(encode)
    return getUrl('/v1/token',{
        headers: {
            authorization: 'Basic ' + encode
        }
    })
}

//移动端登录
export const loginMb=(data)=>{
    const {username,password}=data
    //btoa  64位加密一波
    //atob  64位解密一波
    console.log(username,password,1)
    const encode = btoa(encodeURI(username+':'+password))
    return app.get('/v1/token', {
        headers: {
            authorization: 'Basic ' + encode
        }
    })
}

//移动端注册
export const register = (data) => {
    return postUrl('/v1/registry', { ...data })
}